var ajaxHelper = require("../../utils/ajaxhelp");
let token = wx.getStorageSync('token');
const serviceUrl = getApp().globalData.serviceUrl;

const QueryRecommendListByConditions = (startDateStr, endDateStr, contactid, state, istohospital) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Recommend/QueryRecommendListByConditions", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		startDateStr: startDateStr,
		endDateStr: endDateStr,
		contactid: contactid,
		state: state,
		istohospital: istohospital
	})
}
const QueryRecommendById = (recommendid) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Recommend/QueryRecommendById", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		recommendid: recommendid
	})
}
const GetAllHospital = () => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Hospital/Get", {
		'Authorization': 'Bearer ' + token
	}, "GET", null)
}
const UpdateRecommendAndLead = (recommend = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Recommend/UpdateRecommendAndLead", {
		'Authorization': 'Bearer ' + token
	}, "POST", recommend)
}
const AddRecommendAndLead = (recommend = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Recommend/AddRecommendAndLead", {
		'Authorization': 'Bearer ' + token
	}, "POST", recommend)
}
module.exports = {
	QueryRecommendListByConditions,
	QueryRecommendById,
	GetAllHospital,
	UpdateRecommendAndLead,
	AddRecommendAndLead
}
